<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
<?php echo "Setup Creatives"; ?>
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
<div id="content" class="box">
	<h1>Setup Creatives for <?php echo $campaign['name'];?></h1>
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
		<fieldset>
			<legend>Setup Creatives</legend>
		<?php if (isset($errors)) 
				{
					foreach ($errors as $error)
					{
		?>
				<p class="msg error"><?php echo $error;?></p>
		<?php		}
				}
		?>
		<form method="POST" action="<?php echo url('campaign/creative');?>">
		<input type="hidden" name="cam_id" value="<?php echo $campaign['id'];?>"/>
		<table class="full-size">
			<tr>
				<th>&nbsp;</th>
				<th>Name</th>
				<th>Type</th>
				<th>Size</th>
				<th>Creative</th>
			</tr>
			<?php
				foreach($creatives as $creative)
				{
			?>
			<tr>
				<td><input type="checkbox" name="<?php echo 'cre'.$creative['id'];?>" 
				<?php
					foreach ($selected as $s)
					{
						if ($s['cre_id'] == $creative['id'])
							echo 'checked="checked"';
					}
				?>/></td>
				<td><?php echo $creative['name'];?></td>
				<td><?php echo Util::getCreativeType($creative['type']);?></td>
				<td><?php echo Util::getCreativeSize($creative['size']);?></td>
				<td><img src="<?php echo $creative['url'];?>"/></td>
			</tr>
			<?php
				}
			?>
		</table>
		<input type="submit" class="input-submit" value="Save"/>
		</form>
	</fieldset>
</div>
<?php $this->_endblock(); ?>
